package cn.regexp.web.controller;

import cn.regexp.domain.Product;
import cn.regexp.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {

    @Autowired
    private IProductService productService;
    @Value("${server.port}")
    private String port;

    @RequestMapping("/get")
    public Product get(Long id) {
        Product product = productService.get(id);
        product.setPname(product.getPname() + " --> " + port);
        return product;
    }
}
